package ma.katrav.ws.endpoint;

import ma.katrav.oxm.model.CodeRetour;
import ma.katrav.oxm.model.ResponseDetail;
import ma.katrav.ws.oxm.model.authentification.AuthentificationResponse;
import ma.katrav.ws.oxm.model.compte.AddCompteRequest;
import ma.katrav.ws.oxm.model.compte.CompteOperationResponse;
import ma.katrav.ws.oxm.model.compte.RemoveCompteRequest;
import ma.katrav.ws.oxm.model.compte.UpdateCompteRequest;

import org.springframework.ws.server.endpoint.annotation.Endpoint;
import org.springframework.ws.server.endpoint.annotation.PayloadRoot;
import org.springframework.ws.server.endpoint.annotation.RequestPayload;
import org.springframework.ws.server.endpoint.annotation.ResponsePayload;
import org.springframework.ws.soap.server.endpoint.annotation.SoapAction;

@Endpoint
public class CompteEndpoint {

	// Request name
	public static final String REQUEST_ADD_COMPTE_NAME    = "AddCompteRequest";
	public static final String REQUEST_REMOVE_COMPTE_NAME = "RemoveCompteRequest";
	public static final String REQUEST_Update_COMPTE_NAME = "UpdateCompteRequest";
	public static final String REQUEST_List_COMPTE_NAME   = "ListCompteRequest"; 
	// The namespace of both request and response as declared in the XSD file
	public static final String NAMESPACE_URI = "http://katrav.ma/ws/schema/oss";

	@PayloadRoot(localPart=REQUEST_ADD_COMPTE_NAME , namespace = NAMESPACE_URI)
	@ResponsePayload
	public CompteOperationResponse processesAddCompte(@RequestPayload AddCompteRequest request){
		CompteOperationResponse cor = new CompteOperationResponse();
		ResponseDetail responseDetail = new ResponseDetail();
		responseDetail.setCodeRetour(CodeRetour.SUCCES.getCodeRetour());
		responseDetail.setDescription("Response processesAddCompte With Secces");
		cor.setResponseDetail(responseDetail);
		return cor;
	}
	
	@PayloadRoot(localPart=REQUEST_REMOVE_COMPTE_NAME , namespace = NAMESPACE_URI)
	@ResponsePayload
	public CompteOperationResponse processesRemoveCompte(@RequestPayload RemoveCompteRequest request){
		CompteOperationResponse cor = new CompteOperationResponse();
		ResponseDetail responseDetail = new ResponseDetail();
		responseDetail.setCodeRetour(CodeRetour.SUCCES.getCodeRetour());
		responseDetail.setDescription("Response processesRemoveCompte With Secces");
		cor.setResponseDetail(responseDetail);
		return cor;
	}
	
	@PayloadRoot(localPart=REQUEST_Update_COMPTE_NAME , namespace = NAMESPACE_URI)
	@ResponsePayload
	public CompteOperationResponse processesUpdateCompte(@RequestPayload UpdateCompteRequest request){
		CompteOperationResponse cor = new CompteOperationResponse();
		ResponseDetail responseDetail = new ResponseDetail();
		responseDetail.setCodeRetour(CodeRetour.SUCCES.getCodeRetour());
		responseDetail.setDescription("Response processesUpdateCompte With Secces");
		cor.setResponseDetail(responseDetail);
		return cor;
	}
	
}
